<script>
var mcArray = [] ;
var scArray = [] ;
<!--{if $categoryInfo}-->
	<!--{foreach from=$categoryInfo.mc item=c_l}-->
		mcArray.push (["<!--{$c_l->bigCategoryID}-->" , "<!--{$c_l->midCategoryID}-->","<!--{$c_l->description}-->"]);
	<!--{/foreach}-->

	//组装小分类数组
	<!--{foreach from=$categoryInfo.sc item=s_val}-->
		<!--{assign var=sid value=$s_val->bigCategoryID|cat:$s_val->midCategoryID}-->
		scArray.push(["<!--{$s_val->bigCategoryID}--><!--{$s_val->midCategoryID}-->" , "<!--{$s_val->smallCategoryID}-->" , "<!--{$s_val->description}-->"]);
	<!--{/foreach}-->
<!--{/if}-->

//根据大分类显示中分类
function changeBigCate(){
	var bigVal = document.getElementById('bigCate').value;
	if(bigVal == 0 ){
		
		var sidStr = '<select name="midCate" id="midCate" style="width:110px;">';
			sidStr += '<option value="0">请选择</option>';
			sidStr += "</select>" ;
		document.getElementById('midcateDiv').innerHTML = sidStr ; 
		
		var sidStr = '<select name="smallCate" id="smallCate" style="width:110px;">';
			sidStr += '<option value="0">请选择</option>';
			sidStr += "</select>" ;
		document.getElementById('smallcateDiv').innerHTML = sidStr ; 
	}else{
		var midStr = '<select name="midCate" id="midCate" onchange="changeMidCate()" style="width:110px;">';
			midStr += '<option value="0">请选择</option>';
			
		for( key in mcArray ){
			if( mcArray[key][0] == bigVal )
				midStr += "<option value=" + mcArray[key][1] +">" + mcArray[key][2] + "</option>";
		}
		midStr += "</select>" ;
		document.getElementById('midcateDiv').innerHTML = midStr ; 
		
		var sidStr = '<select name="smallCate" id="smallCate" style="width:110px;">';
			sidStr += '<option value="0">请选择</option>';
			sidStr += "</select>" ;				
		document.getElementById('smallcateDiv').innerHTML = sidStr ; 
	}
}

//根据中分类显示小分类
function changeMidCate(){
	var bigVal = document.getElementById('bigCate').value;
	var midVal = document.getElementById('midCate').value;
	if( midVal == 0 ){
		var sidStr = '<select name="smallCate" id="smallCate" style="width:110px;">';
			sidStr += '<option value="0">请选择</option>';
			sidStr += "</select>" ;
		document.getElementById('smallcateDiv').innerHTML = sidStr ; 
	}else{
		var sidStr = '<select name="smallCate" id="smallCate" style="width:110px;">';
			sidStr += '<option value="0">请选择</option>';
			
		var cid = String(bigVal) + String(midVal) ;

		for( key in scArray ){
			if( scArray[key][0] == cid )
				sidStr += "<option value=" + scArray[key][1] +">" + scArray[key][2] + "</option>";
		}
		sidStr += "</select>" ;
		document.getElementById('smallcateDiv').innerHTML = sidStr ; 
	}
}
</script>

<div style="float:left;margin-top:1px;">
	<div style="width:120px;float:left">
		<select id="bigCate" name="bigCate" onchange="changeBigCate()" style="width:110px;">
			<option value="0">请选择</option>
			<!--{if $categoryInfo}-->
				<!--{foreach from=$categoryInfo.bc item=b_l}-->
					<option value="<!--{$b_l->bigCategoryID}-->"><!--{$b_l->description}--></option>
				<!--{/foreach}-->
			<!--{/if}-->
		</select>
	</div>
	<div style="width:120px;float:left" id="midcateDiv">
		<select id="midCate" name="midCate" onchange="changeMidCate()" style="width:110px;">
			<option value="0">请选择</option>
		</select>
	</div>
	<div style="width:120px;float:left" id="smallcateDiv">
		<select id="smallCate" name="smallCate" style="width:110px;">
			<option value="0">请选择</option>
		</select>
	</div>
</div>